home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / Io.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  3.9 KB  |  173 lines

  1. /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.1 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6. #ifndef __IO_H
  7. #define __IO_H 1
  8.  
  9. #if __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  14. #ifndef _CRTAPI1
  15. #define _CRTAPI1 __cdecl
  16. #endif
  17.  
  18. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  19. #ifndef _CRTAPI2
  20. #define _CRTAPI2 __cdecl
  21. #endif
  22.  
  23. /* Define CRTIMP */
  24. #ifndef _CRTIMP
  25. #if defined(_WIN32) && defined(_DLL)
  26. #define _CRTIMP  __declspec(dllimport)
  27. #else
  28. #define _CRTIMP
  29. #endif
  30. #endif
  31.  
  32. #if __OS2__ && __INTSIZE == 4
  33. #define __CLIB  __stdcall
  34. #else
  35. #define __CLIB  __cdecl
  36. #endif
  37.  
  38. #ifndef __STDC__
  39. #if !defined(_WCHAR_T_DEFINED)
  40. typedef unsigned short wchar_t;
  41. #define _WCHAR_T_DEFINED 1
  42. #endif
  43. #endif
  44.  
  45. _CRTIMP int __CLIB read(int,void *,unsigned);
  46. _CRTIMP int __CLIB write(int,const void *,unsigned);
  47. #define _read read
  48. #define _write write
  49.  
  50. #if __INTSIZE == 2
  51. int __CLIB _readx(int,void *,unsigned,unsigned);
  52. int __CLIB _writex(int,void *,unsigned,unsigned);
  53. #endif
  54.  
  55. #if M_UNIX || M_XENIX
  56. char __CLIB *ttyname(int filedes);
  57. int __CLIB rdchk(int filedes);
  58. int __cdecl ioctl(int filedes, int cmd,...);
  59. long __cdecl ulimit(int,long);
  60. #else
  61. int __cdecl dos_open(const char *,int);
  62. int __cdecl sopen(const char *, int, int, ...);
  63. int __CLIB setmode(int,int);
  64. int __cdecl _umask(int mask);
  65. int __CLIB chmod(const char *,int);
  66. #define _setmode setmode
  67. #define _sopen sopen
  68. #define umode _umode
  69. #define umask _umask
  70. #endif
  71.  
  72. struct ftime   
  73. {
  74.    unsigned ft_tsec  : 5;
  75.    unsigned ft_min   : 6;
  76.    unsigned ft_hour  : 5;
  77.    unsigned ft_day   : 5;
  78.    unsigned ft_month : 4;
  79.    unsigned ft_year  : 7;
  80. };
  81.  
  82. #ifndef __NT__
  83. #ifndef DOS386
  84. int __CLIB getftime(int FHdl, struct ftime *FtPtr);
  85. int __CLIB setftime(int handle, struct ftime *ptr);
  86. int __CLIB lock(int FHdl, long Offset, long Size);
  87. int __CLIB unlock(int handle, long offset, long length);
  88. #endif /* DOS386 */
  89. #endif
  90.  
  91. int __cdecl creatnew(const char *, int);
  92. int __cdecl creattemp(char *, int);
  93. int __cdecl open(const char *,int,...);
  94. int __CLIB creat(const char *,int);
  95. int __CLIB close(int);
  96. int __CLIB locking(int, int, long);
  97. int __CLIB _commit(int);
  98. int __CLIB eof(int handle);
  99. int __CLIB rename(const char *, const char *);
  100. #define _open open
  101. #define _close close
  102. #define _creat creat
  103. #define _locking locking
  104. #define _eof eof
  105.  
  106. #ifdef __NT__
  107. long __CLIB _get_osfhandle(int);
  108. int __CLIB _open_osfhandle(long,int);
  109. #endif
  110.  
  111. int __CLIB unlink(const char *);
  112. #define _unlink unlink
  113.  
  114. int __CLIB remove(const char *);
  115. int __CLIB chsize(int, long);
  116. #define _chsize chsize
  117. #define tell( handle ) _lseek( handle, 0L, SEEK_CUR )
  118. #define _tell tell
  119.  
  120. #define _chmod chmod
  121.  
  122. int __CLIB dup(int);
  123. int __CLIB _dup(int);
  124. int __CLIB dup2(int, int);
  125. char * __CLIB mktemp(char *);
  126. #define _mktemp mktemp
  127. #define _dup2 dup2
  128.  
  129. int __CLIB access(const char *,int);
  130. #define _access access
  131.  
  132. #define F_OK    0
  133. #define X_OK    1
  134. #define W_OK    2
  135. #define R_OK    4
  136.  
  137. long __CLIB lseek(int,long,int);
  138. #define _lseek lseek
  139. #define SEEK_SET        0
  140. #define SEEK_CUR        1
  141. #define SEEK_END        2
  142.  
  143. long __CLIB filesize(const char *);
  144. long __CLIB filelength(int);
  145. int __CLIB isatty(int);
  146. #define _filelength filelength
  147. #define _isatty isatty
  148.  
  149. unsigned short __CLIB getDS(void);
  150.  
  151. #ifndef __STDC__
  152. #define getDS() ((unsigned short)__emit__(0x8C,0xD8))
  153. #endif
  154.  
  155. #ifdef __NT__
  156. #ifndef __STDC__
  157. int __CLIB _wsopen(const wchar_t *, int, int, ...);
  158. int __CLIB _wchmod(const wchar_t *, int);
  159. int __CLIB _wopen(const wchar_t *,int,...);
  160. int __CLIB _wcreat(const wchar_t *,int);
  161. int __CLIB _wrename(const wchar_t *, const wchar_t *);
  162. int __CLIB _wunlink(const wchar_t *);
  163. wchar_t * __CLIB _wmktemp(wchar_t *);
  164. int __CLIB _waccess(const wchar_t *, int);
  165. #endif
  166. #endif
  167.  
  168. #if __cplusplus
  169. }
  170. #endif
  171.  
  172. #endif
  173.